package com.swordget.controller;

import com.swordget.entity.vo.*;
import com.swordget.service.CheckLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: David
 * @Date: Created in 13:27 2020/5/7
 * @Description: 审核 相关
 * @Modified By:
 * @Version: 0.0.1
 */
@RestController
@RequestMapping("/checkLog")
public class CheckLogController {


    private CheckLogService checkLogService;


    @Autowired
    public CheckLogController(CheckLogService checkLogService) {
        this.checkLogService = checkLogService;
    }

    @GetMapping
    public SimplePageResponseVo getData(SimplePageRequestVo pageRequestVo) {
        int page = pageRequestVo.getPage();
        int rows = pageRequestVo.getRows();
        return checkLogService.findAllByPage(page, rows);
    }


    @PutMapping
    public SimpleResponseVo modify(@RequestBody  SimpleRequestVo<CheckLogVo> requestVo) {

        CheckLogVo checkLogVos = requestVo.getData();
        String loginId = requestVo.getLoginId();

        boolean f = checkLogService.modify(checkLogVos, loginId);
        if (f) {
            return SimpleResponseVo.success();
        }
        return SimpleResponseVo.fail("处理失败");
    }

}
